package
{
	import flash.events.MouseEvent;
	
	public class ScreenHome extends Screen {
		
		private var skin:mcScreenHomeSkin;
		
		public function ScreenHome()
		{
			
			super();
			
		}
		
		override public function init():void 
		{
			
			destroy();
			skin = new mcScreenHomeSkin();
			addChild(skin);
			skin.btnPlay.addEventListener(MouseEvent.CLICK, handleHomeSelectionMade);
			skin.btnInstructions.addEventListener(MouseEvent.CLICK, handleHomeSelectionMade);
			skin.btnAchievements.addEventListener(MouseEvent.CLICK, handleHomeSelectionMade)
			
		}
		
		private function handleHomeSelectionMade(e:MouseEvent):void
		{
			
			var s:String = e.currentTarget.name;
			
				if (s == "btnPlay")
				{
					
					gotoAndStop("Sure?");
					
				} else if (s == "btnInstructions") {
					
					gotoAndStop("Instructions");
					
				} else {
					
					gotoAndStop("Achievements");
					
				}
		}
		
		override public function destroy():void
		{
			
			trace("kill.destroy");
			removeChild(skin);
			skin = null;
			
		}
	}
}